package com.onetwork.core.ui.components.dialog;

import com.onetwork.core.ui.components.dialog.actions.CancelaAction;
import com.onetwork.core.ui.components.dialog.actions.ConfirmaAction;
import com.onetwork.core.ui.components.dialog.actions.PrimeiroRegistroAction;
import com.onetwork.core.ui.components.dialog.actions.ProximoRegistroAction;
import com.onetwork.core.ui.components.dialog.actions.RegistroAnteriorAction;
import com.onetwork.core.ui.components.dialog.actions.UltimoRegistroAction;
import com.onetwork.core.ui.components.dialog.listeners.DialogListener;
import javax.swing.JDialog;

public class ListagemDialog extends JDialog implements DialogListener {

    public ListagemDialog() {
        this.setTitle("Listagem");
        this.setModal(true);
        initComponents();
        
        this.mainToolBar.add(new ConfirmaAction(this));
        this.mainToolBar.add(new CancelaAction(this));
        
        PrimeiroRegistroAction primeiroRegistroAction = new PrimeiroRegistroAction(this);
        RegistroAnteriorAction registroAnteriorAction = new RegistroAnteriorAction(this);
        ProximoRegistroAction proximoRegistroAction = new ProximoRegistroAction(this);
        UltimoRegistroAction ultimoRegistroAction = new UltimoRegistroAction(this);
        
        this.topToolBar.add(primeiroRegistroAction);
        this.topToolBar.add(registroAnteriorAction);
        this.topToolBar.add(proximoRegistroAction);
        this.topToolBar.add(ultimoRegistroAction);
        
        this.bottonToolBar.add(primeiroRegistroAction);
        this.bottonToolBar.add(registroAnteriorAction);
        this.bottonToolBar.add(proximoRegistroAction);
        this.bottonToolBar.add(ultimoRegistroAction);
    }
    
    public void dialogListenerLimpar() {}

    public void dialogListenerPesquisar() {}

    public void dialogListenerConfirmar() {}

    public void dialogListenerCancelar() {
        this.setVisible(false);
    }
    
    public void primeiroRegistro() {}
    
    public void registroAnterior() {}

    public void proximoRegistro() {}

    public void ultimoRegistro() {}

    

    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        topToolBar = new javax.swing.JToolBar();
        bottonToolBar = new javax.swing.JToolBar();
        jScrollPane1 = new javax.swing.JScrollPane();
        mainTable = new org.jdesktop.swingx.JXTable();
        mainToolBar = new javax.swing.JToolBar();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        topToolBar.setFloatable(false);
        topToolBar.setRollover(true);

        bottonToolBar.setFloatable(false);
        bottonToolBar.setRollover(true);

        mainTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        mainTable.setColumnControlVisible(true);
        jScrollPane1.setViewportView(mainTable);

        mainToolBar.setFloatable(false);
        mainToolBar.setRollover(true);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(bottonToolBar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 550, Short.MAX_VALUE)
            .addComponent(mainToolBar, javax.swing.GroupLayout.DEFAULT_SIZE, 550, Short.MAX_VALUE)
            .addComponent(topToolBar, javax.swing.GroupLayout.DEFAULT_SIZE, 550, Short.MAX_VALUE)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 550, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(mainToolBar, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(topToolBar, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 290, Short.MAX_VALUE)
                .addGap(0, 0, 0)
                .addComponent(bottonToolBar, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-558)/2, (screenSize.height-405)/2, 558, 405);
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JToolBar bottonToolBar;
    private javax.swing.JScrollPane jScrollPane1;
    private org.jdesktop.swingx.JXTable mainTable;
    private javax.swing.JToolBar mainToolBar;
    private javax.swing.JToolBar topToolBar;
    // End of variables declaration//GEN-END:variables
}
